< previous page page_681 next page >

Page 681
You can send a WM_SETREDRAW message to most list boxes and combo boxes with the SendMessage() API call. You pass a True or False value to tell the control to turn on or off its redraw functionality. You can then load the control and tell it to turn on its redraw capability.
Using Move Is Faster Than Setting Left and Top Properties
If you need to move a form or a control to a new location, make sure you always use the Move method instead of setting the Top and Left properties separately. Every time you set the Top property, it will move the form/control and then redraw the entire form/control. When you then set the Left property, it will also move the form/control and redraw the entire form/control. This cause two paint operations, and in a graphical environment, this can take awhile. Therefore, avoid code like the following:
9f31265bb40b592b1929e18a47ab28e5.gif
For intLoop = 1 To 1500
   lblMove.Top = intLoop
   lblMove.Left = intLoop
Next
Instead, use the Move method, like this:
9f31265bb40b592b1929e18a47ab28e5.gif
For intLoop = 1 To 1500
   lblMove.Move intLoop, intLoop
Next
Transaction Processing
If youre updating the values of several records inside a loop, you should place BeginTrans and CommitTrans around the loop. This can significantly speed up the update process. Therefore, you should avoid using code like this:
9f31265bb40b592b1929e18a47ab28e5.gif
For lngLoop = 0 To 10
   oRS.MoveFirst
   Do Until oRS.EOF
      oRS!szLast_nm = "GATES"
      oRS.Update
      oRS.MoveNext
   Loop
Next

 
< previous page page_681 next page >

If you like this book, buy it!